<?php
/*
 * @Description: 
 * @Author: Leequik
 * @Date: 2025-03-21 22:20:52
 * @LastEditTime: 2025-03-26 10:00:21
 * @LastEditors: Leequik
 */

namespace App\Console\Commands;

use Illuminate\Console\Command;
use App\Jobs\QueueJobs;

class QueueDaley extends Command
{
    /**
     * The name and signature of the console command.
     * 队列名称：app:queue-daley
     * 
     * 发送队列命令：php artisan app:queue-daley
     * 
     * @var string
     */
    protected $signature = 'app:queue-daley';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = '延时队列';

    /**
     * Execute the console command.
     */
    public function handle()
    {
        //
        $this->daley_queue();
    }

    public function daley_queue()
     {
        $queue = 'daley_queue';
        QueueJobs::dispatch('延迟队列=>任务发送时间：'.date('Y-m-d H:i:s'))
        ->delay(now()->addSeconds(random_int(0, 10)))
        ->onQueue($queue);
        $this->info('延迟队列=>任务已发送到队列！');
     }


}
